package cn.imvc.app.controllers.goods;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import cn.imvc.app.entities.Country;
import cn.imvc.app.models.CountryModel;
import cn.imvc.data.domain.ViewRequest;

public class CountryControllerImpl implements CountryController{

	public Page<Country> page;
	public ViewRequest viewRequest;
	public Country country;
	public int id;
	@Autowired
	CountryModel countryModel;
	
	public String dialog(){
		if(viewRequest==null){
			viewRequest = new ViewRequest();
		}
		if(viewRequest.getParams() == null){
			viewRequest.setParams(new HashMap<>());
		}
		viewRequest.getParams().put("_and_type_eq_string", "0");
		page = countryModel.find(viewRequest);
		return "country/dialog";
		
	}
	public String dialog1(){
		if(viewRequest==null){
			viewRequest = new ViewRequest();
		}
		if(viewRequest.getParams() == null){
			viewRequest.setParams(new HashMap<>());
		}
		viewRequest.getParams().put("_and_type_eq_string", "1");
		page = countryModel.find(viewRequest);
		return "country/dialog1";
		
	}
	public String search() {
		return null;
	}

	public String index() {
		return null;
	}

	public String show() {
		return null;
	}

	public String editNew() {
		return null;
	}

	public String create() {
		return null;
	}

	public String edit() {
		country = countryModel.get(id);
		return "country/edit";
	}

	public String update() {
		return null;
	}

	public String destroy() {
		return null;
	}

	public String destroyBatch() {
		return null;
	}
	public ViewRequest getViewRequest() {
		return viewRequest;
	}
	public void setViewRequest(ViewRequest viewRequest) {
		this.viewRequest = viewRequest;
	}
	public Country getCountry() {
		return country;
	}
	public void setCountry(Country country) {
		this.country = country;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

}
